<template>
    <div>
        <el-button type="info">新 建</el-button>
        <el-table :data="tableData">
            <el-table-column type="index" label="序号">
            </el-table-column>
            <el-table-column prop="roleName" label="角色名称">
            </el-table-column>
            <el-table-column prop="remarks" label="备注">
            </el-table-column>
            <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button type="text" size="small">配置</el-button>
                    <el-button type="text" size="small">查看</el-button>
                    <el-button type="text" size="small">修改</el-button>
                    <el-button type="text" size="small">删除</el-button>
                </template>
            </el-table-column>
        </el-table>

        <!-- 分页 -->
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :current-page="pagination.showApage" :page-sizes="[10, 20, 50, 100]" :page-size="pagination.pageNum"
            layout="total, sizes, prev, pager, next, jumper" :total="pagination.total">
        </el-pagination>
    </div>
</template>

<script>
export default {
    data() {
        return {
            // 分页
            pagination: {
                // 显示第几页
                showApage: 1,
                // 总条数
                total: 50,
                // 每页显示多少条
                pageNum: 10,
            },
            tableData: [{
                // 角色名称
                roleName: '管理员',
                // 备注
                remarks: '暂无',
            }, {
                roleName: '超级管理员',
                remarks: '暂无',
            }, {
                roleName: '管理员',
                remarks: '暂无',
            }, {
                roleName: '超级管理员',
                remarks: '暂无',
            }]
        }
    },
    methods: {
        // 每页条数
        handleSizeChange(e) {
            this.pagination.pageNum = e
            // 重新掉一下数据
        },
        // 当前第几页
        handleCurrentChange(val) {
            this.pagination.showApage = val
            // 重新掉一下数据
        },
    }

}
</script>

<style lang="less" scoped></style>